﻿using ilanver.Core.DomainModel;
using System;
namespace ilanver.Core.EntityModel
{
    [Serializable]
    public class MainCategory : Entity
    {
        public virtual int? DefaultGroupItemId
        {
            get;
            private set;
        }
        public virtual int? GroupType
        {
            get;
            private set;
        }
        public virtual bool IsCoverageUnique
        {
            get;
            private set;
        }
        public virtual bool? IsGroupable
        {
            get;
            private set;
        }
        public virtual int Order
        {
            get;
            private set;
        }
        public virtual int ParentGroupItemId
        {
            get;
            private set;
        }
        public virtual int ParentId
        {
            get;
            private set;
        }

        public override bool Equals(object obj)
        {
            if (ReferenceEquals(this, obj))
                return true;

            return Equals(obj as MainCategory);
        }

        public virtual bool Equals(MainCategory obj)
        {
            if (obj == null) return false;

            if (Equals(DefaultGroupItemId, obj.DefaultGroupItemId) == false)
                return false;

            if (Equals(GroupType, obj.GroupType) == false)
                return false;

            if (Equals(Id, obj.Id) == false)
                return false;

            if (Equals(IsCoverageUnique, obj.IsCoverageUnique) == false)
                return false;

            if (Equals(IsGroupable, obj.IsGroupable) == false)
                return false;

            if (Equals(Order, obj.Order) == false)
                return false;

            if (Equals(ParentGroupItemId, obj.ParentGroupItemId) == false)
                return false;

            if (Equals(ParentId, obj.ParentId) == false)
                return false;

            return true;
        }

        public override int GetHashCode()
        {
            int result = 1;

            result = (result * 397) ^ (DefaultGroupItemId != null ? DefaultGroupItemId.GetHashCode() : 0);
            result = (result * 397) ^ (GroupType != null ? GroupType.GetHashCode() : 0);
            result = (result * 397) ^ (Id != null ? Id.GetHashCode() : 0);
            result = (result * 397) ^ (IsCoverageUnique != null ? IsCoverageUnique.GetHashCode() : 0);
            result = (result * 397) ^ (IsGroupable != null ? IsGroupable.GetHashCode() : 0);
            result = (result * 397) ^ (Order != null ? Order.GetHashCode() : 0);
            result = (result * 397) ^ (ParentGroupItemId != null ? ParentGroupItemId.GetHashCode() : 0);
            result = (result * 397) ^ (ParentId != null ? ParentId.GetHashCode() : 0);
            return result;
        }
    }
}
